Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Rails v7.2 #15

Merged
merged 1 commit into from
May 18, 2024

Conversation

ezekg
Copy link
Contributor

@ezekg ezekg commented May 17, 2024

Closes #14. Starting with a draft PR until an alpha release is officially cut. Also — I can't get the tests to pass locally, even for Rails v7.1, so I must not be doing something right or perhaps the contributing docs are out of date.

DB=sqlite3 BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile BUNDLE_PATH=.bundle bundle
DB=sqlite3 BUNDLE_GEMFILE=gemfiles/rails_7_1.gemfile BUNDLE_PATH=.bundle bundle exec rake test
# => .FFF..F........F.FFF..F........FFF..FF...FFFFFFFFFFFFFFF..FFF.F.FFFFF.FF.FFF.F.FFF..FFFF......FFF..FF...F..FFFF..FS.S.S.S....FFFFFFFFFFFFFFFFFFF.......FFF..FF...FFFFFFFFFFF.FFFFFF.FFF.FFFFFFFFF.FFFFFFFFFF.....FFF..FF...FFFFFFFF
#
#    Finished in 2.015876s, 112.6061 runs/s, 301.6058 assertions/s.
#
#      1) Failure:
#         wa#test_0002_finds a matching belongs_to [test/tests/scoping/wa_belongs_to_test.rb:26]:
#         Expected a match but got none for S0.where_assoc_count(matching_nb=1, :==, :b1, ...)
#         Doing the operations manually through ActiveRecord doesn't give the expected result. Expected to find a result with size == to 1, but got these sizes: [0].
#    ...
#    138) Failure:
#         wa#test_0006_polymorphic belongs_to on abstract model works on its descendant with poly_belongs_to: :pluck [test/tests/wa_abstract_model_test.rb:67]:
#         Expected a match but got none for S0.where_assoc_count(matching_nb=1, :==, :bp1, ...)
#         Doing the operations manually through ActiveRecord doesn't give the expected result. Expected to find a result with size == to 1, but got these sizes: [0].
#
#    227 runs, 608 assertions, 138 failures, 0 errors, 4 skips

Regardless, I think the failures are unrelated to the PR because they also fail locally on v7.1.

@@ -94,7 +94,7 @@ def self.create_default!(*source_associations)

def create_has_one!(association_name, attrs = {})
association_name = ActiveRecordWhereAssoc::ActiveRecordCompat.normalize_association_name(association_name)
reflection = self.class.reflections[association_name]
reflection = self.class._reflections[association_name]
Copy link
Contributor Author

@ezekg ezekg May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like Rails v7.2 has symbol keys for ._reflections and string keys for .reflections. 🤪

@MaxLap MaxLap marked this pull request as ready for review May 18, 2024 13:40
@MaxLap MaxLap merged commit 2c1bdf9 into MaxLap:master May 18, 2024
22 checks passed
@MaxLap
Copy link
Owner

MaxLap commented May 18, 2024

Thank you!
I really can't explain why you are getting those errors, they are weird.

There is just .github/workflows/run_tests_on_head.yml which, being auto-generated, isn't meant to be edited directly. I'll take care of it, and change to Ruby 3.3 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Rails v7.2
2 participants